﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InStockDetail.aspx.cs" Inherits="InStock_InStockDetail" %>
 

    <%@ Register Assembly="WX.WMS.Common" Namespace="WX.WMS.Common" TagPrefix="cc1" %>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>入库单维护</title>
        
    <link href="../css/base.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="../JavaScript/jq.js"></script>
        <script type="text/javascript" src="../JavaScript/ymPrompt.js"></script>  
        <script type="text/javascript" src="../JavaScript/AjaxJS.js"></script>
            <script type="text/javascript">
            function submitCheck()
            {
             var item=document.getElementById('InStockID');
//             if(item.value=='') {
//                alert('入仓单号不能为空');
//                return　false;
//             }
             item=document.getElementById('InStockDate');
             if(item.value=='') {
                alert('入仓日期不能为空');
                return　false;
             }
           	    
            }
        function yinyong_onclick() {

            var Url="../Product/NQ_Products_CommonWindow.aspx";
            var result=window.showModalDialog(Url,'','dialogWidth:590px;status:no;dialogheight:500px');   
            if(result!=null)
            {          
               var item=document.getElementById("<%=StoreID.ClientID %>");
               item.value=result;
               __doPostBack('UpdateDetail','');
            }else
            {
              
            }


        }   	
        function SaveValidate()
        {

         var OutStockCode =document.getElementById("OutStockCode");
         var PacketQty =document.getElementById("PacketQty");
         var PacketQty2 =document.getElementById("PacketQty2");
         var NetWeight =document.getElementById("NetWeight");
         var GrossWeight = document.getElementById("GrossWeight");
         var BarCode = document.getElementById("BarCode");
         var re = /^\d+(\.\d+)?$/;
                if(BarCode.value=="")
          {
	                    alert('请选择商品');
                         return false;
          }
          if(OutStockCode.value=="")
          {
	                    alert('请输入出仓单号');
                         return false;
          }
              if (!re.test(NetWeight.value))
                {
                    alert("净重格式不正确,应该为数值");               
                 
		           return false;
                }
                if(!re.test(GrossWeight.value))
                {
                    alert("毛重格式不正确，应该为数值");               
                 
		           return false;
                } 
                if(!re.test(PacketQty.value))
                {
                    alert("大件数应该是整数");
                   
                  
		           return false;
                }    
               if(!re.test(PacketQty2.value))
                {
                    alert("小件数应该是整数");
                   
                  
		           return false;
                }                                 
        }
            </script>
            <style type="text/css">
            .hidden
            {
            	 display:none;
            	}
                .style2
                {
                    width: 79px;
                }
                .style3
                {
                    width: 97px;
                }
                .style4
                {
                    width: 81px;
                }
                .style5
                {
                    width: 115px;
                }
                .style6
                {
                    width: 83px;
                }
            </style>
    </head>
    <body>
        
        <form id="form1" runat="server">
            <input id="SupplierID" style="width: 17px" type="hidden" />
        <div  style="margin:0 auto; width:100%;  text-align:center;">
            <DIV  
    style="BORDER-RIGHT: #a4d5e3 1px solid; margin:20px auto; width:750px; BORDER-TOP: #a4d5e3 1px solid; BACKGROUND: url(../images/content_bg1.gif) repeat-x 50% bottom; BORDER-LEFT: #a4d5e3 1px solid;  BORDER-BOTTOM: #a4d5e3 1px solid; ">
        <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0  >
      <TBODY>
      <TR>
        <TD class=title align=middle height=50>
            <asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label>
           </TD></TR>
      <TR>
        <TD bgColor=#ffffff style="height: 118px" valign="top">
          <TABLE cellSpacing=1 cellPadding=1 width="700" align=center border=0>
            <TBODY>
            <TR>
              <TD bgColor=#ffffff style="width: 240px; height: 9px;">制单日期：
                  <asp:TextBox ID="CreateTime" runat="server" Width="111px" CssClass="txt_left" ReadOnly="True"></asp:TextBox>
                  </TD>        
              <TD bgColor=#ffffff style="width: 220px; height: 9px;">进仓单号：<asp:TextBox ID="InStockID" runat="server" Width="150px" CssClass="txt_left" ></asp:TextBox>
              </TD>

              <TD bgColor=#ffffff style="height: 9px;" align="left">
                  入库类型 ：
                  <asp:DropDownList ID="Type" runat="server">
                  </asp:DropDownList>
                  </TD>
           </TR>
            <TR>

              <TD bgColor=#ffffff style="width: 240px; height: 9px;">报关单号：
                  <asp:TextBox ID="ApplyID" runat="server" Width="111px" CssClass="txt_left"> </asp:TextBox>
                  </TD>
              <TD bgColor=#ffffff style="width: 220px; height: 9px;">电子帐册项号：<asp:TextBox ID="EAccount" runat="server" Width="120px" CssClass="txt_left" ></asp:TextBox>
              </TD>              
              <TD bgColor=#ffffff style="height: 9px;" align="left">
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;客户： 
                  <asp:DropDownList ID="Client" runat="server"  DataTextField="NAME" DataValueField="ID">
                  </asp:DropDownList>
                  </TD>
           </TR> 
            <TR>

              <TD bgColor=#ffffff style="width: 240px; height: 9px;">
                   进仓日期：<asp:TextBox ID="InStockDate" runat="server" Width="90px" CssClass="txt_left" ></asp:TextBox>&nbsp;
                  <IMG 
                style="CURSOR: hand" 
                onclick="fPopUpCalendarDlg(InStockDate);return false;" height=16 
                alt=弹出日历下拉菜单 src="../images/calendar.gif" width=16>
                  </TD>
              <TD bgColor=#ffffff style="width: 220px; height: 9px;">原始单号：<asp:TextBox ID="RawID" 
                      runat="server" Width="120px" CssClass="txt_left" ></asp:TextBox>
              </TD>              
              <TD bgColor=#ffffff style="height: 9px;" align="left">
                  &nbsp;车牌号码： 
                    <asp:TextBox ID="CarNO" 
                      runat="server" Width="80px" CssClass="txt_left" ></asp:TextBox>                  
                  </TD>                  
              
           </TR>     
<TR>

              <TD bgColor=#ffffff style="height: 9px; text-align:left;" colspan="3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：<asp:TextBox ID="AllRemark" runat="server" Width="500px" CssClass="txt_left" ></asp:TextBox>&nbsp;&nbsp;
                  </TD>
              
           </TR>                           
            <TR>
              <TD bgColor="#ffffff" colSpan="3" style="height: 34px; text-align:center;">
                  <asp:Button ID="MainSave" runat="server" Text="保存入库单" 
                      OnClientClick="return submitCheck();" onclick="MainSave_Click" />
                  <asp:Button ID="MainDelete" runat="server" Text="删除该单" Visible="false" 
                      OnClientClick="javascript:if(!confirm('您确定要删除吗?'))return  false;" 
                      onclick="MainDelete_Click" />
                   <asp:Button ID="MainFinish" runat="server" Text="完成所有" Visible="false" 
                      OnClientClick="javascript:if(!confirm('您确定完成所有吗?'))return  false;" 
                      onclick="MainFinish_Click" />
                    <asp:Button ID="btnReport" runat="server" Text="详细报表" 
                      onclick="btnReport_Click"    />                      
<%--                   <asp:Button ID="MainFinish0" runat="server" Text="返回列表" 
                      onclick="MainFinish0_Click"   />--%>
                    <asp:Button ID="btnReport2" runat="server" Text="汇总报表" 
                      onclick="btnReport2_Click"  />                      
                   </TD>
                   </TR></TBODY></TABLE></TD></TR>
      </TBODY></TABLE>
      </div>
            <div   runat="server" visible="false" id="DetailDiv"
    style="BORDER-RIGHT: #a4d5e3 1px solid; margin:20px auto; width:750px; BORDER-TOP: #a4d5e3 1px solid; BACKGROUND: url(../images/content_bg1.gif) repeat-x 50% bottom; BORDER-LEFT: #a4d5e3 1px solid;  BORDER-BOTTOM: #a4d5e3 1px solid; ">
      <table border="0" style="width: 731px;" cellpadding="0" cellspacing="0" >
      <tr>
        <td height="24" align="right" class="style3">商品：</td>
        <td style="width: 150px"><input id="ProductsName" style="width: 71px" type="text" class="txt_left" runat="server" />
            <input id="ProductsID" style="width: 17px" type="hidden"  runat="server"/>
            <input id="yinyong" type="button" value="引用" onclick="return yinyong_onclick()" /></td>
        <td align="right" class="style2">条形码：</td>
        <td style="width:120px">
        <input id="BarCode"  style="width: 110px" type="text" class="txt_left"  runat="server" />
         <input id="ProductDetailID"  type="hidden" runat="server" />
        </td>
        <td align="right" class="style4"><p >型号：</p></td>
        <td class="style5"><input id="Model"  style="width: 83px" type="text" class="txt_left"  runat="server" />
            </td>
        <td align="right" class="style6"><p >规格：</p></td>
        <td ><input id="Standard"  style="width: 83px" type="text" class="txt_left"   runat="server"/>
            </td>        
      </tr>
      <tr>
        <td height="24" align="right" class="style3">产地：</td>
        <td style="width: 150px"><input id="Origin" style="width: 120px" type="text" class="txt_left"   runat="server"/>
            <input id="Hidden1" style="width: 17px" type="hidden" />
                                </td>
        <td  align="right" class="style2">牌子：</td>
        <td style="width:120px">&nbsp;<input id="Brand"  style="width: 110px" type="text" class="txt_left"   runat="server"/></td>
        <td  align="right" class="style4"><p >柜号：</p></td>
        <td class="style5"><input id="PacketNO"  style="width: 83px" type="text" class="txt_left"  runat="server"/>
            </td>
        <td align="right" class="style6"><p >关键规格：</p></td>
        <td ><input id="KeyStandard"  style="width: 83px" type="text" class="txt_left"   runat="server"/>
            </td>    
           
      </tr>  
      <tr>
        <td height="24"  align="right" class="style3">主批次：</td>
        <td style="width: 150px"><input id="LotNumber" style="width: 120px" type="text" class="txt_left"  runat="server" />
            <input id="Hidden2" style="width: 17px" type="hidden" />
                                </td>
        <td  align="right" class="style2">次批次：</td>
        <td style="width:120px">&nbsp;<input id="SubLotNumber"  style="width: 110px" type="text" class="txt_left"  runat="server" /></td>
        <td  align="right" class="style4"><p >原始日期：</p></td>
        <td class="style5">
            <asp:TextBox ID="ProductedDate" runat="server" Width="83px" CssClass="txt_left" ></asp:TextBox>
            <IMG 
                style="CURSOR: hand" 
                onclick="fPopUpCalendarDlg(ProductedDate);return false;" height=16 
                alt=弹出日历下拉菜单 src="../images/calendar.gif" width=16>
        </td>
        <td align="right" class="style6"><p >尺寸：</p></td>
        <td ><input id="Size"  style="width: 83px" type="text" class="txt_left"  runat="server"/>
            </td>     
                 
      </tr>    
        <tr>
        <td height="24"  align="right" class="style3">供应商批次：</td>
        <td style="width: 150px">
            <input id="SupplyLotNumber" style="width: 120px" type="text" class="txt_left"  runat="server" />
        </td>
        <td  align="right" class="style2">货物大类：</td>
        <td style="width:120px">
            <input id="BigClass"  style="width: 110px" type="text" class="txt_left"  runat="server" /></td>
        <td  align="right" class="style4"><p ></p></td>
        <td class="style5">
            
        </td>
        <td align="right" class="style6"><p ></p></td>
        <td ></td>     
                 
      </tr>
        <tr>
        <td height="24"  align="right" class="style3">库位：</td>
        <td style="width: 150px" align="left">
           &nbsp;&nbsp; <asp:DropDownList ID="Stock" runat="server"  AutoPostBack="true" DataValueField="STOCK_ID" DataTextField="STOCK_NAME"
                onselectedindexchanged="Stock_SelectedIndexChanged" Width="115px">
            </asp:DropDownList>
            </td>
        <td  align="right" class="style2">库区：</td>
        <td style="width:120px" align="left">
            &nbsp;&nbsp;  <asp:DropDownList ID="Area" runat="server" AutoPostBack="true"  DataValueField="AREA_ID" DataTextField="AREA_NAME"
                onselectedindexchanged="Area_SelectedIndexChanged" Width="105px">
            </asp:DropDownList>
                                </td>
        <td  align="right" class="style4"><p >层：</p></td>
        <td align="left" class="style5">
 &nbsp; &nbsp; 
            <asp:DropDownList  DataValueField="FloorID" DataTextField="FloorName"
                ID="Floor" runat="server" Width="75px">
            </asp:DropDownList>
            </td>
        <td align="right" class="style6"><p >库存类型：</p></td>
        <td >
            <asp:DropDownList ID="StockType" runat="server" Width="75px">
            </asp:DropDownList>
                                </td>        
      </tr>    
        <tr>
        <td height="24"  align="right" class="style3">大件数：</td>
        <td style="width: 150px">
        <input id="PacketQty"  style="width: 105px" type="text" class="txt_left"  runat="server" />
        <asp:Label ID="PacketQtyUnit" runat="server" Text="件"></asp:Label>
            </td>
        <td  align="right" class="style2">小件数：</td>
        <td style="width:120px">
                    <input id="PacketQty2" style="width: 91px" type="text" class="txt_left"   
                runat="server"/>&nbsp;&nbsp;
                  <asp:Label ID="PacketQty2Unit" runat="server" Text="件"></asp:Label>

            </td>
        <td  align="right" class="style4"><p >净重：</p></td>
        <td class="style5">
        <input id="NetWeight"  style="width: 70px" type="text" class="txt_left"  
                runat="server" /><asp:Label ID="NewWeightUnit" runat="server" Text="kg"></asp:Label>
       </td>
        <td align="right" class="style6"><p >毛重：</p></td>
        <td >
 <input id="GrossWeight"  
                style="width: 55px" type="text" class="txt_left"  runat="server" /><asp:Label ID="GrossWeightUnit" runat="server" Text="kg"></asp:Label>        
        </td>        
      </tr>         
     
      <tr>
        <td height="22"  align="right" class="style3">描述：</td>
        <td colspan="7"><input id="Remark" type="text" style="width: 458px" class="txt_left"  runat="server" />
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
            <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="../images/Save.gif"  
                onclick="ImageButton1_Click" />
        </td>
      </tr>
    </table>
      </div>
            
      <div  style="BORDER-RIGHT: #a4d5e3 1px solid; margin:20px auto; width:750px; BORDER-TOP: #a4d5e3 1px solid; BACKGROUND: url(../images/content_bg1.gif) repeat-x 50% bottom; BORDER-LEFT: #a4d5e3 1px solid;  BORDER-BOTTOM: #a4d5e3 1px solid; text-align:center; ">
    <cc1:GridView ID="SearchResult" runat="server" AutoGenerateColumns="False"  AllowSorting="True"
                BackColor="White" AllowPaging="True"
                BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                Width="100%" DataKeyNames="ID"  
              CheckTemplateStyle="CheckTemplateStyle" EnableEmptyContentRender="True" 
              RadioBoxKeyName="radioId" SelectBoxKeyName="CheckItem" ShowRadioBox="False" 
              ShowSelectBox="False" 
              onrowdeleting="SearchResult_RowDeleting" 
              onpageindexchanging="SearchResult_PageIndexChanging" 
              onsorting="SearchResult_Sorting" 
              onselectedindexchanged="SearchResult_SelectedIndexChanged"   >
                <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                <Columns>
<%--                    <asp:BoundField DataField="INSTOCK_ID" HeaderText="入仓单号"  />--%>
                     <%--                    <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="SysUserManager.aspx?action=edit&amp;ID={0}"
                        HeaderText="编辑" Text="&lt;img border=0 src=../images/Edit.gif /&gt;">
                        <ItemStyle Width="30px" />
                    </asp:HyperLinkField>--%>
<%--                    <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="SysUserSearch.aspx?action=del&amp;ID={0}"
                        HeaderText="删除" Text="&lt;img border=0 src=../images/Close.gif /&gt;">
                        <ItemStyle Width="30px" />
                    </asp:HyperLinkField>--%><asp:TemplateField HeaderText="商品名称" SortExpression="T_PRODUCT_DETAIL.T_PRODUCT.NAME">
                     <ItemTemplate>
                      <%# ((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem).T_PRODUCT_DETAIL.T_PRODUCT.NAME%>
                     </ItemTemplate>                 
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="条形码"  SortExpression="T_PRODUCT_DETAIL.BAR_CODE">
                     <ItemTemplate>
                      <%# ((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem).T_PRODUCT_DETAIL.BAR_CODE%>
                     </ItemTemplate>                 
                     </asp:TemplateField>                 
                     <asp:TemplateField HeaderText="大件数" SortExpression="PACKET_QTY">
                     <ItemTemplate>
                     <%# ((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem).PACKET_QTY%>
                     </ItemTemplate>                 
                     </asp:TemplateField>        
                     <asp:TemplateField HeaderText="小件数" SortExpression="PACKET_QTY2">
                     <ItemTemplate>
                      <%# ((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem).PACKET_QTY2%>
                     </ItemTemplate>                 
                     </asp:TemplateField>       
                     <asp:TemplateField HeaderText="净重" SortExpression="NET_WEIGHT">
                     <ItemTemplate>
                         <%# ((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem).NET_WEIGHT%>
                     </ItemTemplate>                 
                     </asp:TemplateField>         
                     <asp:TemplateField HeaderText="毛重" SortExpression="GROSS_WEIGHT">
                     <ItemTemplate>
                        <%# ((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem).GROSS_WEIGHT%>
                     </ItemTemplate>                 
                     </asp:TemplateField>    
                        <asp:TemplateField HeaderText="库存位置">
                     <ItemTemplate>
                        <%# GetStockPosition(((WX.WMS.DataModel.T_INSTOCK_ITEM)Container.DataItem))%>
                     </ItemTemplate>                 
                     </asp:TemplateField>                                                                     
                    <asp:CommandField SelectText="编辑" ShowSelectButton="True" />
<asp:CommandField DeleteText="&lt;img border=0 src=../images/Close.gif /&gt;" ShowDeleteButton="True" HeaderText="删除" />                    
                </Columns>
                <RowStyle BackColor="White" ForeColor="#003399" HorizontalAlign="Center" VerticalAlign="Middle" />
                <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                <HeaderStyle BackColor="#E2F3FA" Font-Bold="True" ForeColor="Black" />
            </cc1:GridView>
      </div>
            <asp:LinkButton ID="UpdateDetail" runat="server" onclick="LinkButton1_Click"   CssClass="hidden" >LinkButton</asp:LinkButton>
            <asp:TextBox ID="StoreID" runat="server" Text=""  CssClass="hidden"  ></asp:TextBox>
    </div>
        </form>
    </body>
    </html>
 